﻿#pragma once

#include "common.h"
#include "editor/settings.h"
#include "editor/property.h"
#include "vg/stroke.h"
#include "tool.h"

namespace anip
{
	namespace editor
	{
		namespace drawing
		{
			class PenTool : public Tool
			{
			private:
				struct Impl;
				std::unique_ptr<Impl> _pimpl;

			protected:
				void processActivate() override {};
				void processDeactivate() override {};

				void processCreateUI(ui::Container& c) override;
				void processDeleteUI(ui::Container& c) override;

			public:
				struct Parameters
				{
					// ANIP_TODO: elaborate later
					kfloat velocityWidthMultiplier;
					color color = Colors::black;

					NumProperty width{ L"Width", 
						L"The diameter of the area of contact between "
						"the brush/pen and the surface", 
						0.01f, 0.0f, 0.2f };

					Parameters() { }
				};

				Parameters params;

				PenTool();

				wstring name() const override { return L"笔刷"; }

				Texture2D* getIcon() override;

				void drawGizmo(invec2 pos) override;

				bool beginStroke(DrawingArea& area, 
					MouseButton btn, invec2 pos, const StylusData& data) override;

				bool strokePoint(DrawingArea& area, 
					invec2 pos, const StylusData& data) override;

				bool endStroke(DrawingArea& area) override;
			};
		}
	}
}